<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ECSHOP 管理中心 - 商品列表 </title>
<meta name="robots" c>
<meta http-equiv="Content-Type" c />
<link href="/smfs/Public/admin/css/general.css" rel="stylesheet" type="text/css" />
<link href="/smfs/Public/admin/css/main.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="/smfs/Public/admin/js/x-layui.js"></script>
<link href="/smfs/Public/css/layui.css" rel="stylesheet" type="text/css" media="all"/>
<script type="text/javascript" src="/smfs/Public/layui.js"></script>

</head>
<body>

<h1>
<span class="action-span1"><a href="#">回收站</a></span>
<div style="clear:both"></div>
</h1>

<div class="form-div">
  <form action="" name="searchForm">
    <img src="/smfs/Public/admin/images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
    关键字 <input type="text" name="keyword" placeholder="请输入联系人姓名/商品ID" style="width: 150px;"><input type="submit" value=" 搜索 " class="button" />
  </form>
</div>
<form method="post" action="" name="listForm" >
<div class="list-div" id="listDiv">
<table cellpadding="3" cellspacing="1">
  <tr>
    <th>
      <a href="#">订单ID</a><img src="/smfs/Public/admin/images/sort_desc.gif"/>    
    </th>
    <th><a href="#">联系人</a></th>
    <th><a href="#">手机号</a></th>
    <th><a href="#">商品ID</a></th>
    <th><a href="#">类别</a></th>
    <th><a href="#">商品名称</a></th>
    <th><a href="#">价格</a></th>
    <th><a href="#">状态</a></th>
    <th><a href="#">数量</a></th>
    <th><a href="#">预定时间</a></th>
    <th>操作</th>
  </tr>
  <?php foreach ($reserve as $g) { ?>
  <tr style="border: 1px solid #fbf1f1;">
      <td style="border-right: 1px solid #f1f1f1;">【<?php echo ($g["id"]); ?>】</td>
      <td align="center" style="border-right: 1px solid #f1f1f1;"><span ><?php echo ($g["name"]); ?></span></td>
      <td align="center" style="border-right: 1px solid #f1f1f1;"><span ><?php echo ($g["phone"]); ?></span></td>
      <td align="center" style="border-right: 1px solid #f1f1f1;"><span ><?php echo ($g["goods_id"]); ?></span></td>
      <td align="center" style="border-right: 1px solid #f1f1f1;"><span ><?php echo res_catname($g['cat_id']); ?></span></td>
      <td align="center" style="border-right: 1px solid #f1f1f1;"><span ><?php echo ($g["goods_name"]); ?></span></td>
      <td align="center" style="border-right: 1px solid #f1f1f1;"><span ><?php echo ($g["price"]); ?></span></td>

      <?php if ($g['is_chuli'] == 1) { ?>
        <td align="center" style="border-right: 1px solid #f1f1f1;"><span style="background: green;padding: 2px;color: #fff;border-radius: 5px;">已处理</span></td>
      <?php } else { ?>
        <td align="center" style="border-right: 1px solid #f1f1f1;"><span style="background: orange;padding: 2px;color: #fff;border-radius: 5px;">未处理</span></td>
      <?php } ?>

      <td align="center" style="border-right: 1px solid #f1f1f1;"><span ><?php echo ($g["num"]); ?></span></td>
      <td align="center" style="border-right: 1px solid #f1f1f1;"><span ><?php echo date('Y-m-d H:i:s',$g['addtime']) ?></span></td>
      <td align="center">
        <a title="恢复" href="javascript:;" onclick="admin_hf(this,'<?php echo ($g["id"]); ?>')"><span style="background: green;padding: 2px;color: #fff;border-radius: 5px;">恢复</span></a> 
        | 
        <a href="javascript:;" title="删除" onclick="admin_del(this,'<?php echo ($g["id"]); ?>')" style="text-decoration: none;"><span style="background: red;padding: 2px;color: #fff;border-radius: 5px;">删除</span></a>

      </td>
  </tr>
  <?php } ?>
</table>
<style>
    .fenye{ margin-top: 20px;}
    .fenye div {margin-right: 50px;margin-top: 10px;}
    .fenye div a,.fenye div span{display: inline-block;padding: 5px 15px;margin-right: -1px;border: 1px solid #1AA094;}
    .fenye div span{background: #1AA094;color: #fff;}
</style>
<table id="page-table" cellspacing="0">
  <tr>
    <td class="fenye" align="right" nowrap="true"><?php echo ($page); ?></td>
  </tr>
</table>
</div>
</form>

<div id="footer">
共执行 7 个查询，用时 0.112141 秒，Gzip 已禁用，内存占用 3.085 MB<br />
版权所有 &copy; 2005-2010 上海商派网络科技有限公司，并保留所有权利。
</div>

<script>
    layui.use(['laydate','element','laypage','layer'], function(){
        $ = layui.jquery;//jquery
      laydate = layui.laydate;//日期插件
      lement = layui.element();//面包导航
      laypage = layui.laypage;//分页
      layer = layui.layer;//弹出层

    });

    /*删除*/
    function admin_del(obj,id){
        layer.confirm('确认要放入回收站吗？',function(index){
          //发异步删除数据
          id = id;
          $.ajax({
              url: "<?php echo U('admin/reserve/delete');?>",//请求地址
              type: "post",//请求方式
              dataType: "json",//返回数据类型
              data: {id:id},//发送的参数
              })
              .done(function(response) {
                    if(response.error==1){
                      layer.msg(response.info ,{icon:6});
                      $(obj).parents("tr").remove();
                    }else{
                      layer.msg(response.info ,{icon:5});
                    }
                })
              .fail(function() {
                  alert("ajxs交互失败");
              })  
          return false;
        });
    }

    /*恢复*/
    function admin_hf(obj,id){
        layer.confirm('确认要恢复吗？',function(index){
          //发异步删除数据
          id = id;
          $.ajax({
              url: "<?php echo U('admin/reserve/huifu');?>",//请求地址
              type: "post",//请求方式
              dataType: "json",//返回数据类型
              data: {id:id},//发送的参数
              })
              .done(function(response) {
                    if(response.error==1){
                      layer.msg(response.info ,{icon:6});
                      $(obj).parents("tr").remove();
                    }else{
                      layer.msg(response.info ,{icon:5});
                    }
                })
              .fail(function() {
                  alert("ajxs交互失败");
              })  
          return false;
        });
    }
</script>
</body>
</html>